
{extend name="User/index" /}
{block name="users"}
<div class="col-xs-12" style="margin-top: 20px;">
    <table class="table table-striped">
        <input type="hidden" value="{$data.id}" name="id">
        <tr>
            <th>新密码</th>
            <td><input class="form-control" type="password" id="password" name="password" value=""></td>
        </tr>
        <tr>
            <th>重新输入密码</th>
            <td><input class="form-control" type="password" id="repassword" name="repassword" value=""></td>
        </tr>
        <tr>
            <th></th>
            <td><button class="form-control btn-success edit">修改密码</button></td>
        </tr>
    </table>
</div>
<script src="/static/index/js/jquery.min.js"></script>
<script src="/static/index/js/toastr.min.js"></script>
<link href="/static/admin/css/toastr.min.css" rel="stylesheet"/>

<script type="text/javascript">
    $(function(){
        $('.edit').click(function () {

            postdata();
        });
        function postdata(){
            //提交数据函数

            // console.log(123);
            $.ajax({

                //调用jquery的ajax方法
                type: "POST",
                //设置ajax方法提交数据的形式
                url: "/mobile/User/passUpdate",
                //把数据提交到ok.php
                data: {
                    password : $("#password").val(),
                    repassword: $("#repassword").val()
                    // sex : $(".sex").val()
                },
                success: function(data){
                    if (data) {
                        // toastr.success('修改成功,2秒后跳转');
                        // setInterval(function(){
                            location.href='http://47.96.69.12/mobile/user/index';
                        // }, 2000);
                    }else{
                        toastr.error('您没有修改任何内容！');
                    }
                },
                error: function () {
                    alert('交互操作失败');
                }
            });
            return false;
        }
    })
</script>
{/block}

